#next prime number

read n

t = n
found = 0
while found != 1:
	t = t + 1
	i = 2
	found = 1
	while i != t - 2  :
		if t / i * i == t:
			found = 0
		end
		i = i + 1
	end
end
print t
